﻿using ArtClub.Model;
using System;
using System.Collections.Generic;

namespace ArtClub.DAL
{
    internal class ArtClubInitializer : System.Data.Entity.DropCreateDatabaseIfModelChanges<ArtClubContext>
    {
        protected override void Seed(ArtClubContext context)
        {
            //
            // Insert some data into the
            //

            var members = new List<Member>
			{
				new Member() { Name = "Abe1", Points = 50, Division = "gunhild", CreationDate = DateTime.Now },
				new Member() { Name = "Abe2", Points = 500, Division = "gunhild", CreationDate = DateTime.Now },
				new Member() { Name = "Abe3", Points = 25,  Division = "gunhild", CreationDate = DateTime.Now },
				new Member() { Name = "Abe4", Points = 250,  Division = "gunhild", CreationDate = DateTime.Now }
			};
            members.ForEach(m => context.Members.Add(m));

            var artworks = new List<Art>
		    {
		        new Art() {Name = "Art1", Description = "Åh abe", Price = 200},
                new Art() {Name = "Art2", Description = "Mona Liza", Price = 500},
                new Art() {Name = "Art3", Description = "Picasso", Price = 250}
		    };
            artworks.ForEach(a => context.Arts.Add(a));

            // Save changes.
            context.SaveChanges();
        }
    }
}